﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace mobil_lab1
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class MusicWebService : System.Web.Services.WebService
    {

        DatabaseManager dbm;

        public MusicWebService() {
            dbm = DatabaseManager.getInstance();
        }

        [WebMethod]
        public int Size()
        {
            return dbm.Size;
        }

        [WebMethod]
        public void Add(Element element, Element parent)
        {
            dbm.Add(element, parent);
        }

        [WebMethod]
        public void Modify(Element element)
        {
            dbm.Modify(element);
        }

        [WebMethod]
        public List<Element> GetAll()
        {
            return dbm.GetAll();
        }

        [WebMethod]
        public List<Element> GetByParentId(int id)
        {
            return dbm.GetByParentId(id);
        }

        [WebMethod]
        public Element Get(int id)
        {
            return dbm.Get(id);
        }
    }
}
